@import '../../theme/mixins/mixins.scss';
@import '../../theme/_timing-functions.scss';
@import '../../theme/default.scss';

@include b(modal) {
  position: relative;
  top: 100px;
  max-width: 75%;
  margin: 0 auto;
  color: $--color-black;
  background-color: $--color-white;
  border-radius: 4px;

  @include e(mask) {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    height: 100%;
    background-color: $--color-black;
    opacity: 0;
    &-appear-active {
      opacity: 1;
      transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    }
    &-appear-done {
      opacity: 1;
    }
    &-exit {
      opacity: 0;
      transition: opacity 195ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    }
  }

  @include e(wrap) {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow: auto;
    outline: 0;
  }

  @include e(header) {
    position: relative;
    padding: 16px 24px;
    color: rgba(0, 0, 0, 0.65);
    border-bottom: 1px solid $--color-gray;
    border-radius: 4px 4px 0 0;
  }

  @include e(title) {
    color: $--color-black-heavy;
    font-weight: 500;
    font-size: 16px;
  }

  @include e(close) {
    position: absolute;
    top: 50%;
    right: 9px;
    bottom: 0;
    color: $--color-gray-heavy;
    font-size: 26px;
    transform: translateY(-50%);
  }

  @include e(footer) {
    padding: 10px 16px;
    text-align: right;
    border-top: 1px solid $--color-gray;
    button + button {
      margin-left: 8px;
    }
  }

  @include e(body) {
    padding: 24px;
    word-wrap: break-word;
  }

  @include m(zoom) {
    &-appear,
    &-exit {
      animation-play-state: paused;
      animation-fill-mode: both;
    }
    &-appear-active {
      animation: 160ms cubic-bezier(0.4, 0, 0.2, 1) 0s 1 normal both running ty-zoomin,
        100ms cubic-bezier(0.4, 0, 0.2, 1) 60ms 1 normal both running ty-fadein;
    }
    &-exit-active {
      animation: 160ms $timing-fn-ease-in 0s 1 normal both running ty-zoomout,
        100ms $timing-fn-ease-in 60ms 1 normal both running ty-fadeout;
    }
  }
}

@keyframes ty-zoomin {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes ty-zoomout {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(0);
  }
}

@keyframes ty-fadein {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes ty-fadeout {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}
